﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Diagnostics;

public partial class Public_District : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitData();
        }
    }
    protected void InitData()
    {
        MasterPages_ConsumerMaster master = (MasterPages_ConsumerMaster)Page.Master;
        master.DisableFilter();

        Int16 districtId = 0;
        String queryString = Request.QueryString["id"];
        if (!Int16.TryParse(queryString, out districtId))
            return;

        Entities.District district = BLL.Command.GetDistrict(districtId);
        Debug.Assert(district != null);

        name_label.Text = district.Name;
        description_label.Text = district.Description;

        district.TopNum = 0;
        restaurant_datalist.DataSource = district.RestaurantsOfDistrict;
        restaurant_datalist.DataBind();
    }
}
